package org.erepublik.company.comparators;

import java.util.Comparator;

import org.erepublik.company.PriceIndex;

public class InvertPriceSort implements Comparator<PriceIndex> {

    @Override
    public int compare(PriceIndex o1, PriceIndex o2) {
        double comparator = o2.getPrice() - o1.getPrice();
        if (o1.getPrice()==0.0)
            return 1;
        if (o2.getPrice()==0.0)
            return -1;
        if (comparator < 0)
            return 1;
        if (comparator > 0)
            return -1;
        return 0;
    }

}
